#include<stdio.h>
#include<stdlib.h>

typedef struct Node{
    char data[100];
    int cnt;
    struct Node *p,*left,*right;
}TNode;

const char map[10][3] = {
    {},
    {},
    {'A','B','C'},
    {'D','E','F'},
    {'G','H','I'},
    {'J','K','L'},
    {'M','N','O'},
    {'P','R','S'},
    {'T','U','V'},
    {'W','X','Y'}
};
TNode tree[100000];
int flag = 0;

int map_ch(char ch){
    int i,j;
    for(i=0;i<10;i++)
        for(j=0;j<3;j++)
            if(map[i][j] == ch)
                return i;
    return 0;
}

void filter_char(char str[],char c){
    int i,j;
    char ch;
    for(i=0,j=0;str[i] != 0;i++){
        ch = str[i];
        if(ch != c){
            if(ch>='A'&&ch<='Z'){
                str[j++] = '0'+map_ch(ch);
            }
            else
                str[j++] = ch;
        }
    }
    str[j] = '\0';
}

void traverse_tree(TNode *root){
    TNode   *left,*right;
    char str[20];
    int i,j;
    if(root==NULL)
        return;
    left = root->left;
    if(left)
        traverse_tree(left);
    if(root->cnt > 1){
        flag = 1;
        for(i=0,j=0;j<strlen(root->data);){
            if(i==3){
                str[i] = '-';
                i++;
            }else{
                str[i] = root->data[j];
                i++;
                j++;
            }
        }
        str[i] = '\0';
        printf("%s %d\n",str,root->cnt);
    }
    right = root->right;
    if(right)
        traverse_tree(right);
}

void add_tnode(TNode    **rt,TNode* node){
    TNode *root,*left,*right;
    root = *rt;
    int res = 0;

    if(root == NULL){
        *rt = node;
        node->p = *rt;
        return;
    }

    res = strcmp(node->data,root->data) ;
    left = root->left;
    right = root->right;
    if(res == 0){
        root->cnt++;
        return;
    }else if(res < 0){
        if(left){
            add_tnode(&left,node);
        }else{
            root->left = node;
            node->p = root;
        }
    }else{
        if(right){
            add_tnode(&right,node);
        }else{
            root->right = node;
            node->p = root;
        }
    }
}

int main(){
    int num,k=0;
    char str[200];
    TNode *root = NULL,*node;
    scanf("%d",&num);
    while(num--){
        memset(str,0,sizeof(str));
        scanf("%s",str);
        filter_char(str,'-');
        node = &(tree[k++]);
        strncpy(node->data,str,20);
        node->cnt = 1;
        node->left = node->right = node->p = NULL;
        add_tnode(&root,node);
    }
    traverse_tree(root);
    if(!flag)
        printf("No duplicates.\n");
    return 0;
}
